import React from 'react'
import {createBrowserRouter, Navigate} from 'react-router-dom'
import SjcShop from '../pages/sjc/components/Shop'
import Login from "../pages/yzk/Login";
import Zhuce from "../pages/yzk/Zhuce";

import Gouwu from "../pages/yzk/Gouwu";
import Jiesuan from '../pages/yzk/Jiesuan';
import ShopClassify from '../pages/sjc/components/ShopClassify'
import List from '../pages/sjc/components/List'
import Customer from '../pages/sjc/components/Customer'
import Search from '../pages/sjc/components/Search'


const SjcShopHome = React.lazy(() => import("../pages/sjc/components/ShopHome"))
const Info = React.lazy(() => import("../pages/wzq/components/OminiInfo"))
const Wll = React.lazy(() => import("../pages/wzq/components/Wll"))
const Ntce = React.lazy(() => import("../pages/wzq/components/Ntce"))
const Ati = React.lazy(() => import("../pages/wzq/components/Ati"))

const Cxbnotlogin = React.lazy(() => import("../pages/cxb/components/Notlogin"))
const Cxbmy = React.lazy(() => import("../pages/cxb/components/My"))
const Cxbmyorder = React.lazy(() => import("../pages/cxb/components/MyOrder"))
const Cxbaddress = React.lazy(() => import("../pages/cxb/components/Address"))
const Cxbaddaddress = React.lazy(() => import("../pages/cxb/components/Addaddress"))
const Cxbsignin = React.lazy(() => import("../pages/cxb/components/Signin"))
const Cxbsetting = React.lazy(() => import("../pages/cxb/components/Setting"))
const Cxbeditphone = React.lazy(() => import("../pages/cxb/components/Editphone"))
const Cxbabout = React.lazy(() => import("../pages/cxb/components/About"))
const Cxba = React.lazy(() => import("../pages/cxb/components/a"))
const Cxbcollection = React.lazy(() => import("../pages/cxb/components/Collection"))
const TypeList = React.lazy(() => import("../pages/fxs/components/TypeList"))
const Coupons = React.lazy(() => import("../pages/fxs/components/Coupon"))
const GetCoupon = React.lazy(() => import("../pages/fxs/components/GetCoupon"))
//评价
const Comment = React.lazy(() => import("../pages/fxs/components/Comment"))
const SetComment = React.lazy(() => import("../pages/fxs/components/SetComment"))

const Item = React.lazy(() => import("../pages/szh/component/Item"))
const Main = React.lazy(() => import("../pages/szh/component/Main"))
const Bttm = React.lazy(() => import("../pages/szh/component/Bottombutton"))
const Shopye = React.lazy(() => import("../pages/szh/component/Shop"))
const Send = React.lazy(() => import("../pages/szh/component/Send"))
const Gnye = React.lazy(() => import("../pages/szh/component/Gnye"))
const OmiSinfo = React.lazy(() => import("../pages/wzq/components/OmiSinfo"))

//路由守卫
// const Islogin = (props) => {
//     let Rou = props.children.type
//     return localStorage.getItem("token")?<Rou></Rou>:<Navigate to="/login"></Navigate>
// }

const router = createBrowserRouter([
    {
        path: '/pye', element: <Shopye></Shopye>
    },
    {
        path: '/send', element: <Send></Send>
    },
    {
        path: '/gnye', element: <Gnye></Gnye>
    },
    {
        path: '/bttm', element: <Bttm></Bttm>,
        children: [
            {
                path: 'main', element: <Main></Main>
            },
            {
                path: "info", element: <Info></Info>
            },
            {
                path: 'my', element: <Cxbmy></Cxbmy>
            },
            {
                path: "gouwu", element: <Gouwu></Gouwu>
            },
            {
                path: 'my', element: <Cxbmy></Cxbmy>
            },
            {
                path: "wll", element: <Wll></Wll>
            },
            {
                path:'typeList',
                element: <TypeList></TypeList>
            }
        ]
    },
    {
        path: '/item', element: <Item></Item>
    },
    {
        path: '/shop', element: <SjcShop></SjcShop>,
        children: [
            {
                path: "/shop/home", element: <SjcShopHome></SjcShopHome>
            }, {
                path: "/shop/ShopClassify", element: <ShopClassify></ShopClassify>
            }, {
                path: "/shop/list", element: <List></List>
            },
            {
                // 重定向
                path: "/shop", element: <Navigate to="/shop/home"/>
            }]
    }, {
        path: "/gouwu", element: <Gouwu></Gouwu>
    },

    {

        path: "/customer", element: <Customer></Customer>
    }, {
        path: "/", element: <Login/>
    }, {
        path: "zhuce", element: <Zhuce/>
    }, {
        path: "/jiesuan", element: <Jiesuan/>
    },
    {
        path: "/search", element: <Search></Search>
    },
    {
        path: "/app/info", element: <Info></Info>
    },
    {
        path: "/wll", element: <Wll></Wll>
    }, {
        path: "/ntce",
        element: <Ntce></Ntce>
    },
    {
        path: "/ati", element: <Ati></Ati>
    },
    {
        path: '/coupons', element: <Coupons></Coupons>
    },
    {
        path: '/getCoupon',
        element: <GetCoupon></GetCoupon>
    },
    {
        path: '/comment', element: <Comment></Comment>
    },
    {
        path: '/setComment',
        element: <SetComment></SetComment>
    },
    {
        path: "/omibfo/:id/:id1", element: <OmiSinfo></OmiSinfo>
    },
    {
        path: "/customer",
        element: <Customer></Customer>
    },
    {
        path: "/",
        element: <Login/>
    },
    {
        path: "zhuce",
        element: <Zhuce/>
    },
    {
        path: "/jiesuan",
        element: <Jiesuan/>
    },
    {
        path: "/search",
        element: <Search></Search>
    },
    {path: "/wll", element: <Wll></Wll>},
    {path: "/app/info", element: <Info></Info>},
    {path: "/ntce", element: <Ntce></Ntce>},
    {path: "/ati", element: <Ati></Ati>},
    {path: '/notlogin', element: <Cxbnotlogin></Cxbnotlogin>},

    {path: '/myorder', element: <Cxbmyorder></Cxbmyorder>},
    {path: '/address', element: <Cxbaddress></Cxbaddress>},
    {path: '/addaddress', element: <Cxbaddaddress></Cxbaddaddress>},
    {path: '/signin', element: <Cxbsignin></Cxbsignin>},
    {path: '/setting', element: <Cxbsetting></Cxbsetting>},
    {path: '/editphone', element: <Cxbeditphone></Cxbeditphone>},
    {path: '/about', element: <Cxbabout></Cxbabout>},
    {path: '/a', element: <Cxba></Cxba>},
    {path: '/collection', element: <Cxbcollection></Cxbcollection>},
    // { path: '/', element: <Navigate to="/my"></Navigate> },
    {path: '/coupons', element: <Coupons></Coupons>},
    {path: '/getCoupon', element: <GetCoupon></GetCoupon>},
    {path: '/comment', element: <Comment></Comment>},
    {path: '/setComment', element: <SetComment></SetComment>},
    {path: "/omibfo/:id/:id1", element: <OmiSinfo></OmiSinfo>},

])
export default router
